local sk__jici = fk.CreateSkill {

  name = "sk__jici",

  tags = {  },

}



sk__jici:addEffect(fk.DamageInflicted, {
  name = "sk__jici",
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__jici.name) and data.from and data.from ~= player and not data.from.dead
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, sk__jici.name, nil, "#sk__jici-invoke::"..data.from.id)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:doIndicate(player.id, {data.from.id})
    data.from:drawCards(1, sk__jici.name)
    if player.dead or data.from.dead or not player:canPindian(data.from) then return end
    local pindian = player:pindian({data.from}, sk__jici.name)
    if pindian.results[data.from].winner == player then
      return true
    else
      data.damage = math.min(data.damage, 1)
      if not player.dead then
        room:addPlayerMark(player, "@sk__wanglang_raoshe", 1)
        if player:getMark("@sk__wanglang_raoshe") > 6 then
          room:killPlayer({who = player,})
        end
      end
    end
  end
})

return sk__jici